Datacenters deploy a variety of intermediary devices or middleboxes, such as load balancers, firewalls, intrusion detection and prevention systems (IDPS), and virtual private networks (VPNs). These devices provide broad range functionalities to secure, manage, and improve the performance of hosted services as well as support new traffic classes and applications. Even in enterprise networks, the number of middleboxes is becoming comparable to the number of routers. The middleboxes constitute a significant fraction of the network capital costs and operational expenses, e.g., human experts to manage them.